<div class="section"> 
<script type="text/javascript">
$(document).ready(function(){
	$("#agency").change(function(){
		val = $(this).val();
		jQuery.post("<?php echo base_url();?>admin/agency/getcruise",{userid:val},function(result){
			$("#result").html(result);
		});
	});
	$("#ok").click(function(){
		agency = $("#agency").val();
		cruise = $("#cruise").val();
		aname  = $("#agency option:selected").text();
		cname  = $("#cruise option:selected").text();
		if(agency == "0" || cruise == "0"){
			alert("Please select agency & cruise");
			return false;
		}else{
			jQuery.post("<?php echo base_url();?>admin/agency/addcruise",{agency:agency,cruise:cruise,aname:aname,cname:cname},function(result){
				$("#result").html(result);
			});
		}
	});
	$(document).on("click","a.delete",function(){
		$(this).parent().parent().parent().parent().parent().fadeOut();
		id = $(this).attr("rel");
		jQuery.post("<?php echo base_url();?>admin/agency/del",{id:id},function(result){
		});
	});
});
</script> 
  <!--[if !IE]>start title wrapper<![endif]-->
  <div class="title_wrapper"> <span class="title_wrapper_top"></span>
    <div class="title_wrapper_inner"> <span class="title_wrapper_middle"></span>
      <div class="title_wrapper_content">
        <h2 class="menu_title">Add cruises for agency</h2>
      </div>
    </div>
    <span class="title_wrapper_bottom"></span> </div>
  <!--[if !IE]>end title wrapper<![endif]--> 
  <!--[if !IE]>start section content<![endif]-->
  <div class="section_content"> <span class="section_content_top"></span>
    <div class="section_content_inner" style="min-height:300px">
      <div class="table_tabs_menu"> 
        <!--[if !IE]>start  tabs<![endif]--> 
        <!--[if !IE]>end  tabs<![endif]--> 
      </div>
      <!--[if !IE]>start table_wrapper<![endif]-->
      <div class="table_wrapper" style="background:none;">
        <div class="table_wrapper_inner">
          <div class="error_red">
            <?php if(isset($error)) { echo "<p>".$error."</p>"; } ?>
            <?php echo validation_errors();?> </div>
          <form action="javascript:void(0)" method="post" name="sac" onsubmit="" enctype="multipart/form-data">
            <div class="form_items" style="margin-top:5px;">
              <div class="form_items_left">Select agency</div>
              <div class="form_items_right">
                <select id="agency">
                  <option value="0">Select a agency</option>
                  <?php foreach($listages as $item){ ?>
                  <option value="<?php echo $item['user_id']; ?>"><?php echo $item['username']; ?></option>
                  <?php } ?>
                </select>
              </div>
            </div>
            <div class="form_items" style="margin-top:5px;">
              <div class="form_items_left">Select cruise</div>
              <div class="form_items_right">
                <select id="cruise">
                  <option value="0">Select a cruise</option>
                  <?php foreach($listcrui as $items){ ?>
                  <option value="<?php echo $items['sheep_id']; ?>"><?php echo $items['sheep_name']; ?></option>
                  <?php } ?>
                </select>
              </div>
            </div>
            <div class="form_items">
              <div class="form_items_left">&nbsp;</div>
              <div class="form_items_right">
                <input type="submit" name="ok" id="ok" value="Add now" class="magin"/>
              </div>
            </div>
          </form>
        </div>
        <div style="clear:left"></div>
        <div id="result" style="margin-top:20px">
       		 <table cellpadding="0" cellspacing="0" width="905">
                <tbody><tr>
                  <th width="23" style="border-top:1px solid #CCC;border-left:1px solid #CCC">Stt.</th>
                  <th width="185" style="border-top:1px solid #CCC">Agency name</th>
                  <th width="200" style="border-top:1px solid #CCC">Cruise name</th>
                  <th width="90" style="border-top:1px solid #CCC">Agency id</th>
                  <th width="90" style="border-top:1px solid #CCC">Cruise id</th>
                  <th width="180" style="border-top:1px solid #CCC">Created</th>
                  <th width="86" style="border-top:1px solid #CCC">Actions</th>
                </tr>
                <tr>
                  <th colspan="7" height="40" style="border-left:1px solid #CCC;font-weight:normal;font-size:13px;color:#F30">Please select a ageny to view cruises</th>
                </tr>
               </tbody>
             </table>
        </div>
      </div>
      <!--[if !IE]>end table_wrapper<![endif]--> 
    </div>
    <span class="section_content_bottom"></span> </div>
  <!--[if !IE]>end section content<![endif]--> 
</div>
